/*
 * $Id: LocationImportUtilities.java 42 2013-04-17 15:33:59Z gabakyan $
 * $Author: gabakyan $
 * $Revision: 42 $
 * $Date: 2013-04-17 15:33:59 +0000 (Wed, 17 Apr 2013) $
 *
 * Copyright (c) 2013 Supply Chain Intelligence (SCI), Inc.
 * http://www.scintelligence.com/, Email: info@scintelligence.com
 * All rights reserved.
 *
 * This file is part of Logistics Map.
 *
 * Logistics Map is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, version 3 of the License.
 *
 * Logistics Map is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Logistics Map.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.sci.logisticsmap.service.support;

import com.sci.logisticsmap.support.LocationImportSupportedMimeType;

/**
 * The utility class which provides helper methods for importing the Locations.
 *
 * @author gabakyan@gmail.com (Last modified by $Author: gabakyan $)
 * @version $Revision: 42 $
 */
public class LocationImportUtilities {
    /**
     * Checks the CSV MIME Type.
     *
     * @param mimeType The MIME Type.
     *
     * @return <code>true</code> if the CSV MIME Type, otherwise
     * <code>false</code>.
     */
    public static boolean isCSVMimeType(String mimeType) {
        return mimeType.equals(LocationImportSupportedMimeType.TEXT_COMMA_SEPARATED_VALUES)
                || mimeType.equals(LocationImportSupportedMimeType.TEXT_CSV)
                || mimeType.equals(LocationImportSupportedMimeType.APPLICATION_CSV)
                || mimeType.equals(LocationImportSupportedMimeType.APPLICATION_EXCEL_CSV)
                || mimeType.equals(LocationImportSupportedMimeType.APPLICATION_VND_MS_EXCEL)
                || mimeType.equals(LocationImportSupportedMimeType.APPLICATION_VND_MSEXCEL)
                || mimeType.equals(LocationImportSupportedMimeType.TEXT_ANYTEXT);
    }

    /**
     * Checks the plain text MIME Type.
     *
     * @param mimeType The MIME Type.
     *
     * @return <code>true</code> if the plain text MIME Type, otherwise
     * <code>false</code>.
     */
    public static boolean isPlainTextMimeType(String mimeType) {
        return mimeType.equals(LocationImportSupportedMimeType.TEXT_PLAIN);
    }

    /**
     * Checks the supported Locations import MIME Type (CSV or plain text).
     *
     * @param mimeType The MIME Type.
     *
     * @return <code>true</code> if the supported Locations import MIME Type (CSV or plain text), otherwise
     * <code>false</code>.
     */
    public static boolean isSupportedLocationImportMimeType(String mimeType) {
        return isPlainTextMimeType(mimeType) || isCSVMimeType(mimeType);
    }
}
